/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package utils;

/**
 *
 * @author Biddu
 */
public class JGSCommonTools {
    public static boolean containsOnlyNumbers(String str) {

        boolean ret = true;
        //It can't contain only numbers if it's null or empty...
        if (str == null || str.length() == 0) {
            ret = false;
        } else {
            for (int i = 0; i < str.length(); i++) {
                //If we find a non-digit character we return false.
                if (!Character.isDigit(str.charAt(i))) {
                    if (str.indexOf('-') == 0 && i == 0) {
                        continue;
                    }
                    ret = false;
                    break;
                }
            }
        }
        return ret;
    }

}
